#include<iostream>
#include<ctime>
const int N = 1e6 + 10;
using namespace std;
int a[N],n;
//void down(int parent,int len)
//{
//	int child = parent * 2;
//	while (child <= len)
//	{
//		if (child + 1 <= len && a[child] < a[child + 1]) child++;
//		if (a[parent] <= a[child]) return;
//		swap(a[parent], a[child]);
//		parent = child;
//		child = parent * 2;
//	}
//}
int get_random(int left, int right)
{
	return a[rand() % (right - left + 1) / 2 + left];
}
void quick_sort(int left, int right)
{
	if (left >= right) return;
	int t = get_random(left,right);
	int l = left  - 1, r = right + 1, cur = left + 1;
	while (cur < r)
	{
		if (a[cur] > t) swap(a[--r], a[cur]);
		else if (a[cur] < t) swap(a[++l], a[cur]);
		else cur++;
	}
	quick_sort(l, cur);
	quick_sort(cur + 1, r);
}
int main()
{
	srand(time(0));
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i];
	}
	quick_sort(1, n);
	for (int i = 1; i <= n; i++)
	{
		cout << a[i] << ' ';
	}
	return 0;
}